package coframe.web;

import coframe.dao.CofUserAccountDao;
import coframe.entity.CofUserAccount;
import com.ctrip.platform.dal.dao.DalClient;
import com.ctrip.platform.dal.dao.DalClientFactory;
import com.ctrip.platform.dal.dao.DalHints;
import jodd.madvoc.meta.In;
import jodd.madvoc.meta.MadvocAction;
import jodd.madvoc.meta.RestAction;

import java.sql.SQLException;
import java.util.List;

@MadvocAction
public class BookAction {
    private static final String DATA_BASE = "coframe";

    private static DalClient client = null;
    private static CofUserAccountDao dao = null;

    public BookAction(){
        client = DalClientFactory.getClient(DATA_BASE);
        try {
            dao = new CofUserAccountDao();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    @RestAction("{bookId}")
    public List<CofUserAccount> get(@In int bookId) throws SQLException {
        DalHints hints = new DalHints();
        List<CofUserAccount> daoPojos = dao.queryAll(new DalHints());
        return daoPojos;
    }
}